<%@page language="java" pageEncoding="UTF-8"%>
<%@include file="/views/common/include/taglib.jsp"%>
<link type="text/css" rel="stylesheet"
	href="${ctx }/css/dlifestyle/sectionparent.css" source="widget" />
<link type="text/css" rel="stylesheet"
	href="${ctx }/css/dlifestyle/admin.css" source="widget" />
<script
	src="${ctx}/js/controllers/base/cellinfo/CellInfoEditController.js"
	type="text/javascript"></script>
<!-- 图文混排器的预览 -->
<script src="${ctx}/js/common/preview.js" type="text/javascript"></script>
<style>
select {
	padding-left: 8px;
	font-size: 12px;
	border-radius: 10px;
	background-image: none;
	margin-top: 4px;
	width: 130px;
	border: 1px solid #CBD5DD;
	color: #8b8787;
	font-family: "微软雅黑";
}
</style>
<section>
	<div style="height: 40px; line-height: 40px;">
		<div class="forword_area"></div>
		<div class="location">当前位置：${sessionScope.currcent_position}</div>
	</div>
	<hr>
	<div class="panel panel-default">
		<div class="editTitle">
			<div style="height: 41px; width: 190px; float: left;">
				<img style="float: left; margin-left: 37px; margin-top: 9.5px;"
					src="${ctx}/images/new_edit.png" />
				<c:if test="${type == 1 }">
					<h4>新增小区信息</h4>
				</c:if>
				<c:if test="${type == 2 }">
					<h4>编辑小区信息</h4>
				</c:if>
			</div>
			<div>
				<a style="float: right; margin-right: 20px; margin-top: -2px;"
					title="关闭" onclick="cancel();"><img
					src="${ctx}/images/new_close.png" /></a>
			</div>
		</div>
		<div id="form" class="form" style="min-height: 350px;">
			<div class="itemEditMap" style="height: 100px">
				<input id="cellId" type="hidden" value="${cellInfo.id }"> <input
					id="longitude" type="hidden" value="${cellInfo.longitude }">
				<input id="latitude" type="hidden" value="${cellInfo.latitude }">
				<input id="imageLogo" type="hidden" value="${cellInfo.logo }">
				<span class="col-sm-1 editlableEditMap"
					style="height: 100px; line-height: 100px;">图像：</span>
				<div class="flEditMap" style="height: 100px;">

					<c:if test="${cellInfo.logo == null || cellInfo.logo == ''}">
						<img id="preview3"
							style="width: 70px; height: 70px; float: left; margin-top: 10px;"
							title="快上传小区头像吧" src="${ctx}/images/cell_logo.png" />
					</c:if>
					<c:if test="${cellInfo.logo != null && cellInfo.logo != ''}">
						<img id="preview3"
							style="width: 70px; height: 70px; float: left; margin-top: 10px;"
							src="${sessionScope.image_logo}${cellInfo.logo}" />
					</c:if>
					<div class="mtjxsa" style="float: left; margin: 25px 20px;">
						<p style="text-align: left; font-size: 12px;" id="imageBtn">
							<input type="hidden" name="imageLogo" id="imageLogo"
								value="${cellInfo.logo}" /> <label class="lbl"
								style="width: 400px; height: 15px;">提示：只能上传.jpg,
								.png的图片格式,照片文件大小最大为10MB</label>

						</p>
						<div>
							<div class="fl">
								<button
									style="width: 100px; height: 25px; margin-top: 5px; background-color: #593505; color: #fff; border: 0px; line-height: 25px;"
									class="acblu tctpsc">上传头像</button>
							</div>
						</div>
					</div>
					<%@include file="/views/common/uploader/picture.jsp"%>
				</div>
			</div>
			<div class="itemEdit">
				<input id="cellId" type="hidden" value="${cellInfo.id }"> <input
					id="longitude" type="hidden" value="${cellInfo.longitude }">
				<input id="latitude" type="hidden" value="${cellInfo.latitude }">
				<span class="col-sm-1 editlableEdit">小区名称：</span>
				<div class="flEdit">
					<input class="controlEdit" id="cellName" onblur="checkCellName()"
						value="${cellInfo.cellName }" type="text" class="text"
						maxlength="20" placeholder="请输入名称（最多20字）" /> <em class="emStyle">*</em>
				</div>
			</div>
			<div class="itemEdit">
				<span class="col-sm-1 editlableEdit">区域：</span>
				<div class="flEdit">
					<select id="province" onblur="checkProvinceName()"
						style="height: 30px; line-height: 30px; width: 130px; margin-top: 4px;">
						<option value="">--省--</option>
						<c:forEach items="${provinceList}" var="provinceItem"
							varStatus="status">
							<c:if test="${provinceItem.regionName == cellInfo.provinceName}">
								<option id="${provinceItem.regionName}"
									value="${provinceItem.id}" selected>
									${provinceItem.regionName}</option>
							</c:if>
							<c:if test="${provinceItem.regionName != cellInfo.provinceName}">
								<option id="${provinceItem.regionName}"
									value="${provinceItem.id}">${provinceItem.regionName}
								</option>
							</c:if>
						</c:forEach>
					</select> <select id="city" onblur="checkCityName()"
						style="height: 30px; line-height: 30px; width: 130px;">
						<option value="">--市--</option>
						<c:if test="${not empty cityList}">
							<c:forEach items="${cityList}" var="cityItem" varStatus="status">
								<c:if test="${cityItem.regionName == cellInfo.cityName}">
									<option id="${cityItem.regionName}" value="${cityItem.id}"
										selected>${cityItem.regionName}</option>
								</c:if>
								<c:if test="${cityItem.regionName != cellInfo.cityName}">
									<option id="${cityItem.regionName}" value="${cityItem.id}">
										${cityItem.regionName}</option>
								</c:if>
							</c:forEach>
						</c:if>
					</select> <select id="district" onblur="checkAreaName()"
						style="height: 30px; line-height: 30px; width: 135px;">
						<option value="">--区--</option>
						<c:if test="${not empty districtList}">
							<c:forEach items="${districtList}" var="districtItem"
								varStatus="status">
								<c:if test="${districtItem.regionName == cellInfo.areaName}">
									<option id="${districtItem.regionName}"
										value="${districtItem.id}" selected>
										${districtItem.regionName}</option>
								</c:if>
								<c:if test="${districtItem.regionName != cellInfo.areaName}">
									<option id="${districtItem.regionName}"
										value="${districtItem.id}">
										${districtItem.regionName}</option>
								</c:if>
							</c:forEach>
						</c:if>
					</select> <em class="emStyle">*</em>
				</div>
			</div>
			<div class="itemEdit">
				<span class="col-sm-1 editlableEdit">详细地址：</span>
				<div class="flEdit">
					<input class="controlEdit" onblur="checkCellAddress()"
						id="cellAddress" type="text" maxlength="50"
						placeholder="请输入详细地址（最多50字）" value="${cellInfo.cellAddress }"
						style="width: 80%"> <em class="emStyle">*</em>
				</div>
			</div>

			<div class="itemEditMap" style="height: 200px;">
				<span class="col-sm-1 editlableEditMap">地点：</span>
				<div class="flEditMap">
					<div id="allmap" style="width: 400px; height: 200px;"></div>
				</div>
			</div>

			<div class="itemEdit">
				<span class="col-sm-1 editlableEdit">土地面积：</span>
				<div class="flEdit">
					<input class="controlEdit" onblur="isNumber()" style="width: 80px;"
						onblur="isNumber();" id="areaLand" type="text" maxlength="10"
						value="${cellInfo.areaLand}"> <span
						style="font-size: 12px">(㎡)</span> <em class="emStyle">*</em>
				</div>
			</div>
			<div class="itemEdit">
				<span class="col-sm-1 editlableEdit">建筑面积：</span>
				<div class="flEdit">
					<input class="controlEdit" onblur="checkNumber()"
						style="width: 80px;" onblur="checkNumber();" id="areaConstruction"
						type="text" maxlength="10" value="${cellInfo.areaConstruction}">
					<span style="font-size: 12px">(㎡)</span> <em class="emStyle">*</em>
				</div>
			</div>
			<div class="itemEdit">
				<span class="col-sm-1 editlableEdit">排序：</span>
				<div class="flEdit">
					<input class="sortEdit" onblur="checkSort()" id="sort"
						type="text" maxlength="11"
						value="${cellInfo.sort == null ? 1 : cellInfo.sort}"> <em
						class="emStyle">*</em>
				</div>
			</div>
			<div class="itemEdit">
				<label class="col-sm-1 editlableEdit">运营团队：</label>
				<div class="flEdit">
					<select class="editform-control"
						style="height: 30px; width: 140px;" id="operationCompanyId"
						required>
						<option value="">--请选择运营团队--</option>
						<c:forEach items="${operationCompanys}" var="item"
							varStatus="cStatus">
							<option value="${item.id}"
								<c:if test="${item.id == cellInfo.operationCompanyId}">selected="selected"</c:if>>${item.companyName}</option>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="itemEdit">
				<label class="col-sm-1 editlableEdit">物业公司：</label>
				<div class="flEdit">
					<select class="editform-control"
						style="height: 30px; width: 140px;" id="proCompanyId" required>
						<option value="">--请选择物业公司--</option>
						<c:forEach items="${propertyCompanys}" var="item"
							varStatus="cStatus">
							<option value="${item.id}"
								<c:if test="${item.id == cellInfo.proCompanyId}">selected="selected"</c:if>>${item.companyName}</option>
						</c:forEach>
					</select>
				</div>
			</div>
			
			
				<div class="itemEdit">
                    <label class="col-sm-1 editlableEdit">商城支付账号：</label>
                    <div class="flEdit">
                        <select class="editform-control"
                            style="height: 30px; width: 160px;" id="operationCompanyId" required>
                            <option value="">--请选择商城支付账号--</option>
                            <c:forEach items="${accounts}" var="item" varStatus="cStatus">
                                <option value="${item.id}">${item.accountName}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="itemEdit">
                    <label class="col-sm-1 editlableEdit">物业支付账号：</label>
                    <div class="flEdit">
                        <select class="editform-control"
                            style="height: 30px; width: 160px;" id="operationCompanyId" required>
                            <option value="">--请选择物业支付账号--</option>
                            <c:forEach items="${accounts}" var="item" varStatus="cStatus">
                                <option value="${item.id}">${item.accountName}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
				<input type="hidden" id="selectRm" value="${selmenus}"/>
				<div class="itemEdit">
					<span class="col-sm-1 editlableEdit">小区功能：</span>
					<div class="flEdit">
						<button class="editform-control" id="cells" class="text" style="cursor: pointer;height: 30px;width: 140px;" onclick="chooseMenu('${cellInfo.id}');">点击设置</button>
					</div>
				</div>
			<div class="editorDetail" style="background: #fdfdfd;">
				<img style="margin-left: -110px; margin-top: -5px;"
					src="${ctx}/images/content.png" /> <span
					class="col-sm-1 editlableEdit" style="border-right: 0">小区描述：</span>
				<img style="float: right; margin: 12px 20px;" title="内容预览"
					src="${ctx}/images/preview.png" onclick="contentPreview('${ctx}')">
			</div>
			<div style="height: auto; min-height: 261px;">
				<div id="ueditor">
					<!-- <textarea name="content" id="ideaContent" style="width:537px;height:100px;resize:none" class="itxt" maxlength="200" required></textarea> -->

					<!-- 加载编辑器的容器 -->
					<script id="container" type="text/plain">${cellInfo.cellDescription }</script>
					<!-- 配置文件 -->
					<script type="text/javascript"
						src="${ctx }/js/lib/ueditor/ueditor.config.js"></script>
					<!-- 编辑器源码文件 -->
					<script type="text/javascript"
						src="${ctx }/js/lib/ueditor/ueditor.all.js"></script>
					<script type="text/javascript"
						src="${ctx }/js/lib/ueditor/ueditor.parse.js"></script>
					<!-- 实例化编辑器 -->
					<script type="text/javascript">


						var ue = UE.getEditor('container',{
							toolbars : [
								       	  ['fontfamily','fontsize', '|', 'blockquote', 'horizontal', '|', 'removeformat', '|', 'insertimage'],
								       	  ['bold', 'italic', 'underline', 'forecolor', 'backcolor', '|',
								       	   'justifyleft', 'justifycenter', 'justifyright', '|',
								       	   'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
								       	   'insertorderedlist', 'insertunorderedlist', '|',
								       	   'imagenone', 'imageleft', 'imageright', 'imagecenter','autotypeset','cleardoc','source'
								       	   ]
								       	],
							UEDITOR_HOME_URL: '${ctx}/js/lib/ueditor/',
							serverUrl: '${ctx}/fileHandler/upLoaderForUeditor',
							imageUrlPrefix: '${sessionScope.image_logo}',
							imageActionName: 'uploadimage',
							imageFieldName: 'file',
							imageMaxSize: 1024000,
							imageAllowFiles: ['.png', '.jpg', '.jpeg', '.gif'],
							initialFrameHeight: 200,
							initialFrameWidth: '99.86%',
							elementPathEnabled: false,
							retainOnlyLabelPasted:true,
							wordCount: false,
							/* sourceEditor: 'textarea', */
							insertorderedlist: {
								// 系统自带
								'decimal': '',     // '1,2,3...'
								'lower-alpha': '', // 'a,b,c...'
								'lower-roman': '', // 'i,ii,iii...'
								'upper-alpha': '', // 'A,B,C'
								'upper-roman': ''  // 'I,II,III...'
							},
							insertunorderedlist : {
								// 系统自带
								'circle': '',  // '○ 小圆圈'
								'disc': '',    // '● 小圆点'
								'square': ''   // '■ 小方块'
							},
							listDefaultPaddingLeft: '50'
						});
							</script>
				</div>
			</div>

			<div class="foot">
				<button class="buttonCancle" onclick="cancel();">取&nbsp;&nbsp;消</button>
				<button class="buttonEdit" onclick="saveCellInfo();">保&nbsp;&nbsp;存</button>
			</div>
		</div>
		<%@include file="/views/common/footer.jsp"%>
	</div>
</section>
<script type="text/javascript">
		var ctx = '${ctx}';
		setCtx(ctx);
		refreshMap();
		
	</script>

<!-- 解决ie 6 7 8 9不能显示placeholder的问题 -->
<script src="${ctx}/js/lib/jquery.JPlaceholder.js"></script>
